import matplotlib.pyplot as plt
from random_walk import RandomWalk

while True:
    # 创建一个RandomWalk实例，并将其所包含的点都绘制出来
    rw = RandomWalk(5000)
    rw.fill_walk()

    point_numbers = list(range(rw.num_points))

    plt.scatter(rw.x_values,rw.y_values,s=1,c=point_numbers,cmap=plt.cm.Reds,edgecolors='none')

    # 绘制每个点之间的连线
    plt.plot(rw.x_values,rw.y_values,linewidth=0.1)

    # 突出绘制起点和终点
    plt.scatter(rw.x_values[0],rw.y_values[0],c = 'green',edgecolors='none',s=50)
    plt.scatter(rw.x_values[-1],rw.y_values[-1],c = 'red',edgecolors='none',s=50)

    # 隐藏坐标轴
    plt.axes().get_xaxis().set_visible(False)
    plt.axes().get_yaxis().set_visible(False)


    plt.show()

    keep_runnint = input("Make another walk?(y/n)")
    if keep_runnint == 'n':
        print("Bye Bye")
        break